﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Xqsys.DAL
{
  public class DatumUP
    {
        /// <summary>
        /// 上传新的资料
        /// </summary>
        /// <param name="datumUp"></param>
        /// <returns></returns>
        public bool AddDatumUP(MODEL.DatumUp datumUp)
        {
            SqlParameter[] param = new SqlParameter[]
           {
               new SqlParameter("@name",datumUp.Name),
               new SqlParameter("@typeID",datumUp.TypeID),
               new SqlParameter("@introduction",datumUp.Introduction),
               new SqlParameter("@score",datumUp.Score)
           };
            return COM.SqlHelper.ExecuteNonQuery("sp_AddDatumUP", param);
        }
        /// <summary>
        /// 提交上传的资料信息
        /// </summary>
        /// <param name="datumUp"></param>
        /// <returns></returns>
        public bool UpdateDatum(MODEL.DatumUp datumUp)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@datumID",datumUp.DatumID),
                new SqlParameter("@userID",datumUp.UserID),
                new SqlParameter("@inTime",datumUp.Intime),
                new SqlParameter("@name",datumUp.Name),
                new SqlParameter("@typeID",datumUp.DatumID),
                new SqlParameter("@size",datumUp.Size),
                new SqlParameter("@instroduction",datumUp.Introduction),
                new SqlParameter("@score",datumUp.Score),
                new SqlParameter("@state",datumUp.State),
                new SqlParameter("@operTime",datumUp.Opertime),
                new SqlParameter("@manager",datumUp.Manager),
                new SqlParameter("@downTime",datumUp.DownTime)
            };
            return COM.SqlHelper.ExecuteNonQuery("sp_UpdateDatum", param);
        }
        /// <summary>
        /// 资料的删除
        /// </summary>
        /// <param name="datumid"></param>
        /// <returns></returns>
        public bool DeleteDatum(int datumid)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@datumid",datumid)
            };
            return COM.SqlHelper.ExecuteNonQuery("sp_DeleteDatumUp", parms);
        }
        /// <summary>
        /// 资料的查找根据ID
        /// </summary>
        /// <param name="datumid"></param>
        /// <returns></returns>
        public DataSet SelectDatum(int datumid)
        {
            SqlParameter[] parms=new SqlParameter[]
            {
                new SqlParameter("@datumid",datumid)

            };
            return COM.SqlHelper.ExecuteQuery("sp_SelectDatumUp",parms);
        }
    }
}
